package com.xtpt.disaster.utils;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TreeFileUtil {
    /**
     * @Description: 从Linux命令
     *  find folder -type f  | tr '\n' '\0' | xargs -0 ls -la --time-style '+|%Y/%m/%d  %H:%M:%S|'
     * 结果信息中构建目录文件结构树
     * @Author: hpc
     * @Date: 2022/1/9 下午 4:25
     * @param listResult:
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     **/
    public static Map<String,Object> generatorTreeFromLinux(List<String> listResult)
    {
        Map<String,Object> map = new HashMap<>();
        if(listResult==null || listResult.size()==0)
        {
            return map;
        }
        for (String line:listResult) {
            String stripLine=line.trim();
            if(StringUtils.isEmpty(stripLine))
            {
                continue;
            }

        }

        return map;
    }

    /**
     * @Description: 从Windows命令
     * DIR folder /s/a-d/-c
     * 结果信息中构建目录文件结构树
     * @Author: hpc
     * @Date: 2022/1/9 下午 4:25
     * @param listResult:
     * @return: java.util.Map<java.lang.String,java.lang.Object>
     **/
    public static Map<String,Object> generatorTreeFromWindows(List<String> listResult)
    {
        Map<String,Object> map = new HashMap<>();
        if(listResult==null || listResult.size()==0)
        {
            return map;
        }
        for (String line:listResult) {
            String stripLine=line.trim();
            if(StringUtils.isEmpty(stripLine))
            {
                continue;
            }

        }
        return map;
    }
}
